#!/usr/bin/python
from __future__ import with_statement
import os, sys

stocky_path = os.path.split(os.path.abspath(__file__))[0] + "/.."
sys.path.append(stocky_path)

import bootstrap
import stocky.interface

def setupEnv(namespace):
    env = dict (interface = stocky.interface)
    namespace.update(env)

from pa import PAOptionParser as StockieOptionParser

class withValidation:
    def __enter__(self, *args, **kw): pass
    def __exit__(self, typ, value, traceback):
        if isinstance(value, stocky.interface.ValidationError):
            sys.exit("error: %s" % value)

